{#
    SPDX-FileCopyrightText: NVIDIA CORPORATION & AFFILIATES
    Copyright (c) 2024-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
    Apache-2.0
    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at
    http://www.apache.org/licenses/LICENSE-2.0
    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
#}

{%- macro generate_dscp_to_tc_map_per_sku() -%}
    "DSCP_TO_TC_MAP": {
        "AZURE": {
            "0" : "0",
            "1" : "1",
            "2" : "1",
            "3" : "2",
            "4" : "2",
            "5" : "3",
            "6" : "3",
            "7" : "0",
            "8" : "0",
            "9" : "0",
            "10": "0",
            "11": "4",
            "12": "4",
            "13": "4",
            "14": "4",
            "15": "4",
            "16": "4",
            "17": "4",
            "18": "4",
            "19": "4",
            "20": "4",
            "21": "4",
            "22": "4",
            "23": "4",
            "24": "4",
            "25": "4",
            "26": "4",
            "27": "4",
            "28": "4",
            "29": "4",
            "30": "4",
            "31": "5",
            "32": "5",
            "33": "5",
            "34": "5",
            "35": "5",
            "36": "5",
            "37": "5",
            "38": "5",
            "39": "5",
            "40": "5",
            "41": "0",
            "42": "0",
            "43": "0",
            "44": "0",
            "45": "0",
            "46": "0",
            "47": "0",
            "48": "0",
            "49": "0",
            "50": "0",
            "51": "0",
            "52": "0",
            "53": "0",
            "54": "0",
            "55": "0",
            "56": "0",
            "57": "0",
            "58": "0",
            "59": "0",
            "60": "0",
            "61": "0",
            "62": "0",
            "63": "0"
        }
    },
{%- endmacro -%}
{%- macro generate_tc_to_pg_map_per_sku() -%}
    "TC_TO_PRIORITY_GROUP_MAP": {
        "AZURE": {
            "0": "0",
            "1": "0",
            "2": "0",
            "3": "0",
            "4": "0",
            "5": "0",
            "6": "0",
            "7": "0"
        }
    },
{%- endmacro -%}

{%- macro generate_scheduler_per_sku() -%}
    "SCHEDULER": {
        "scheduler.4": {
            "type"  : "DWRR",
            "weight": "4"
        },
        "scheduler.8": {
            "type"  : "DWRR",
            "weight": "8"
        },
        "scheduler.18": {
            "type"  : "DWRR",
            "weight": "18"
        },
        "scheduler.22": {
            "type"  : "DWRR",
            "weight": "22"
        }
    },
{%- endmacro -%}

{%- macro generate_single_queue_per_sku(port) -%}
        "{{ port }}|0": {
            "scheduler": "scheduler.4"
        },
        "{{ port }}|1": {
            "scheduler": "scheduler.8"
        },
        "{{ port }}|2": {
            "scheduler": "scheduler.18"
        },
        "{{ port }}|3": {
            "scheduler": "scheduler.22"
        },
        "{{ port }}|4": {
            "scheduler": "scheduler.22"
        },
        "{{ port }}|5": {
            "scheduler": "scheduler.22"
        },
        "{{ port }}|6": {
            "scheduler": "scheduler.4"
        }
{%- endmacro -%}

{%- macro generate_global_dscp_to_tc_map() %}
{# This is an empty macro since the global DSCP_TO_TC map is not required #}
{%- endmacro %}

{%- macro generate_wred_profiles() %}
    "WRED_PROFILE": {
        "AZURE_LOSSLESS" : {
            "wred_green_enable"      : "true",
            "wred_yellow_enable"     : "true",
            "wred_red_enable"        : "true",
            "ecn"                    : "ecn_all",
            "green_max_threshold"    : "10000000",
            "green_min_threshold"    : "2000000",
            "yellow_max_threshold"   : "10000000",
            "yellow_min_threshold"   : "2000000",
            "red_max_threshold"      : "10000000",
            "red_min_threshold"      : "2000000",
            "green_drop_probability" : "5",
            "yellow_drop_probability": "5",
            "red_drop_probability"   : "5"
        }
    },
{%- endmacro %}

{%- include 'qos_config.j2' %}
